package MyBlog.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import MyBlog.dao.CategoryDao;
import MyBlog.entity.Category;

@Repository("categoryDao")
public class CategoryDaoImpl implements CategoryDao {

	@Autowired
	private HibernateTemplate hibernateTemplate;

	public List<Category> getListByUserId(int userId) {
		return (List<Category>) hibernateTemplate.find("from Category c where c.user.id = ?",userId);
	}

	public Category ftechById(int cid) {
		return hibernateTemplate.get(Category.class, cid);
	}
}
